/**
 * Copyright 2006 The Apache Software Foundation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.ocean.main.fields;

import java.text.ParseException;
import java.util.Map;

import org.apache.ocean.ClusterUtil;
import org.apache.ocean.main.IndexSchema;

import com.ibm.icu.util.ULocale;

/**
 * <code>TextFieldType</code> is the basic type for configurable text
 * analysis. Analyzers for field types using this implementation should be
 * defined in the schema.
 * 
 */
public class TextField extends FieldType implements LocalizableFieldType {
	private ULocale locale;

	public TextField() {
		this.tokenized = new Boolean(true);
		typeName = "text";
	}
  
	protected void init(IndexSchema schema, Map<String, String> args) {
		locale = getLocale(args);
		this.tokenized = new Boolean(true);
	}
  
	public Class getType() {
		return String.class;
	}
	
	public String objectToExternal(Object object) {
		return (String)object;
	}
	
	public String objectToIndexed(Object object) {
		return (String)object;
	}
	
	public Object stringToObject(String string) throws ParseException {
		return string;
	}
	
	public ULocale getLocale() {
		return locale;
	}
}
